// 查询会员卡模板列表接口
const getCardTempPage = (params) => {
    return $axios({
        url: '/cardTemp/page',
        method: 'get',
        params
    })
}
// 查询列表接口
const getCardPage2 = (params) => {
    return $axios({
        url: '/card/page2',
        method: 'get',
        params
    })
}
//查询拥有该卡的用户
const getByIdWithUser = (id) => {
    return $axios({
        url: `/card/getUsersOfCard/${id}`,
        method: 'get'
    })
}
//查询tags表 拼接选择的tags标签，组合成一个字符串  /tags  get [xx,xx,xx]
// function getAllTagsName(){
//     return $axios({
//         url: '/tags/getAllTagsName',
//         method: 'get'
//     })
// }

// 删除卡片模板接口
function deleteTempCard (id) {
    return $axios({
        url: '/cardTemp/deleteTempCard/'+id,
        method: 'delete'
        // params: { id }
    })
}

function deleteCard(param){
    return $axios({
        url:'/card',
        method:'delete',
        params: param
    })
}

// 修会员卡改接口
const editCardTemp = (params) => {
    return $axios({
        url: '/cardTemp/updateTempCard',
        method: 'put',
        data: { ...params }
    })
}

//获取卡片模板信息
const getCardTemp = (id) =>{
    return $axios({
        url:`/cardTemp/getCardById/${id}`,
        method:'get'
    })
}

const getCardDetail = (id) => {
    return $axios({
        url:`/card/detail/${id}`,
        method: 'get'
    })
}
const editCardDetail = (params) => {
    return $axios({
        url:'/card/updateCardDetail',
        method: 'put',
        data: {...params}
    })
}

// 新增会员卡模板的接口
const addCardTemp = (params) => {
    return $axios({
        url: '/cardTemp',
        method: 'post',
        data: { ...params }
    })
}

// 根据cardId查询会员卡详情
const queryCardById = (id) => {
    return $axios({
        url: `/card/${id}`,
        method: 'get'
    })
}

// 查看店铺中的所有会员卡信息（当前卖家拥有卡及其张/名）
function getCards(params){
    return $axios({
        url:'/card/getCards',
        method:'get',
        params
    })
}



// 文件down预览
const commonDownload = (params) => {
    return $axios({
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
        },
        url: '/common/download',
        method: 'get',
        params
    })
}
// 修改---启用禁用接口
function enableOrDisableCard (params) {
    return $axios({
        url: '/card',
        method: 'put',
        data: { ...params }
    })
}

//根据类型获取标签  getTagListByType
function getTagListByType(type){
    return $axios({
        'url': '/tags/getTagListByType?type='+type,
        'method': 'get',
    })
}
